
		<link rel="stylesheet" type="text/css" href="<?php echo Yii::app ()->request->baseUrl; ?>/css/menu/dock.css" />

		<?php 

$cs = Yii::app ()->getClientScript (); 
$cs = Yii::app ()->getClientScript()->registerCoreScript ('jquery'); 
$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/menu/jquery.fixedMenu.js");
$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/fancybox/jquery.fancybox-1.3.4.js");
$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/fancybox/jquery.mousewheel-3.0.4.pack.js");
$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/menu/jquery.opacityrollover.js");
$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/menu/jquery.galleriffic.js");
$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/menu/jquery.history.js");

		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/Three.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Color.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Vector2.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Vector3.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Vector4.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Ray.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Rectangle.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Matrix3.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Matrix4.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Object3D.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Quaternion.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Vertex.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Face3.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Face4.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/UV.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Geometry.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Spline.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/core/Edge.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/cameras/Camera.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/lights/Light.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/lights/AmbientLight.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/lights/DirectionalLight.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/lights/PointLight.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/lights/SpotLight.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/materials/Material.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/materials/LineBasicMaterial.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/materials/MeshBasicMaterial.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/materials/MeshLambertMaterial.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/materials/MeshPhongMaterial.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/materials/MeshDepthMaterial.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/materials/MeshNormalMaterial.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/materials/MeshFaceMaterial.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/materials/MeshShaderMaterial.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/materials/ParticleBasicMaterial.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/materials/ParticleCanvasMaterial.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/materials/ParticleDOMMaterial.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/textures/Texture.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/textures/DataTexture.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/objects/Particle.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/objects/ParticleSystem.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/objects/Line.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/objects/Mesh.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/objects/Bone.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/objects/SkinnedMesh.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/objects/Ribbon.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/objects/LOD.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/objects/Sprite.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/scenes/Scene.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/scenes/Fog.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/scenes/FogExp2.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/Projector.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/DOMRenderer.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/CanvasRenderer.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/SVGRenderer.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/WebGLShaders.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/WebGLRenderer.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/WebGLRenderTarget.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/WebGLRenderTargetCube.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/renderables/RenderableVertex.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/renderables/RenderableFace3.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/renderables/RenderableFace4.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/renderables/RenderableObject.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/renderables/RenderableParticle.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/renderers/renderables/RenderableLine.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/ColorUtils.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/GeometryUtils.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/ImageUtils.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/SceneUtils.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/ShaderUtils.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/animation/AnimationHandler.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/animation/Animation.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/cameras/FirstPersonCamera.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/cameras/PathCamera.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/cameras/FlyCamera.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/cameras/RollCamera.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/cameras/TrackballCamera.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/cameras/QuakeCamera.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/core/Curve.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/core/CurvePath.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/core/Path.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/core/Shape.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/core/TextPath.js"); 
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/geometries/CubeGeometry.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/geometries/CylinderGeometry.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/geometries/ExtrudeGeometry.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/geometries/IcosahedronGeometry.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/geometries/LatheGeometry.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/geometries/PlaneGeometry.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/geometries/SphereGeometry.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/geometries/TextGeometry.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/geometries/TorusGeometry.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/geometries/TorusKnotGeometry.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/loaders/Loader.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/loaders/JSONLoader.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/loaders/BinaryLoader.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/loaders/SceneLoader.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/loaders/UTF8Loader.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/objects/MarchingCubes.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/objects/Trident.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/physics/Collisions.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/physics/CollisionUtils.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/renderers/AnaglyphWebGLRenderer.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/extras/renderers/CrosseyedWebGLRenderer.js");

		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/RequestAnimationFrame.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/fonts/helvetiker_regular.typeface.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/Stats.js");
		
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/menu/jquery.fixedMenu.js");
		$cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/menu/dock.js");
    // $cs->registerScriptFile(Yii::app ()->request->baseUrl. "/js/threejs/Detector.js");


?>
	<script type="text/javascript">
		$(function(){
			var stageWidth,stageHeight;
			var container,camera,scene,renderer;
			var radius = 600;
	      	var theta = 0;
			var moveUp = false;
			var moveDown = false;
			var moveLeft = false;
			var moveRight = false;
			var object1,cubesize=40;
			var mouse2D, mouse3D, ray;
			var projector;
			init();
			animate();
			
		function init(){
			stageWidth=window.innerWidth;
        	stageHeight=window.innerHeight;
			container = document.createElement( 'div' );
			// camera = new THREE.Camera( 30, stageWidth / stageHeight, 1, 10000 );
        	// //camera.position.z = 1500;
        	// camera.position.x = 2000;
        	// camera.position.y = 2000;
        	// camera.target.position.y = 100;
   			camera = new THREE.Camera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
				camera.position.y = 800;
				camera.target.position.y = 200;
			scene = new THREE.Scene();
			
			plane = new THREE.Mesh( new THREE.PlaneGeometry( 1600, 1600, cubesize, cubesize ), new THREE.MeshBasicMaterial( { color: 0x999933, wireframe: true } ) );
        	plane.rotation.x = - 90 * Math.PI / 180;
        	plane.name="background";
        	scene.addObject( plane );
        	projector = new THREE.Projector();
        	ray = new THREE.Ray( camera.position, null );
							// // Grid
// 
				// var geometry = new THREE.Geometry();
				// geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( - 500, 0, 0 ) ) );
				// geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 500, 0, 0 ) ) );
// 
				// var material = new THREE.LineBasicMaterial( { color: 0x000000, opacity: 0.2 } );
// 
				// for ( var i = 0; i <= 20; i ++ ) {
// 
					// var line = new THREE.Line( geometry, material );
					// line.position.z = ( i * 50 ) - 500;
					// scene.addObject( line );
// 
					// var line = new THREE.Line( geometry, material );
					// line.position.x = ( i * 50 ) - 500;
					// line.rotation.y = 90 * Math.PI / 180;
					// scene.addObject( line );
// 
				// }
        	
        	

        	
			renderer = new THREE.WebGLRenderer( { antialias: true } );
        	renderer.setSize( stageWidth, stageHeight );

        	container.appendChild( renderer.domElement );
        	object1=new THREE.Object3D;
        	scene.addObject( object1 );
        	createBlock(1);
			$('body').html(container);
		};
		
		function createBlock(blockType){
			switch(blockType){
				case 1:
				//1，x,y,z=4,1,4
        		cubeGeo = new THREE.CubeGeometry( cubesize, cubesize, cubesize );
        		cubeMaterial = new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff });
        		cubeMaterial.color.setHSV( 0.1, 0.7, 1.0 );
        		cube = new THREE.Mesh( cubeGeo, [ new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ), new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true } ) ] );
        		cube.position.x=-20;
				cube.position.z=-20;
        		cube2 = new THREE.Mesh( cubeGeo, [ new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ), new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true } ) ] );
				cube2.position.x=cube.position.x+cubesize;
				cube2.position.z=cube.position.z;
        		object1.addChild(cube);
        		object1.addChild(cube2);
        		
				object1.position.y=400;

        		break;
			}
		};
		
			 function animate() {
		
		        requestAnimationFrame( animate );
		
		        render();
		
		     };

		     function render() {
				
				// if ( moveForward ) camera.position.z -= 10; // camera.moveZ( 10 );
				// if ( moveBackwards ) camera.position.z += 10; // camera.moveZ( - 10 );

				// if ( moveUp ) cube.position.y += 10; // camera.moveZ( 10 );
				// if ( moveDown ) cube.position.y -= 10; // camera.moveZ( - 10 );
// 
				// if ( moveLeft ) cube.position.x -= 10; // camera.moveX( - 10 );
				// if ( moveRight ) cube.position.x += 10; // camera.moveX( 10 );

				if(object1.position.y>0)object1.position.y -= 1;
		        camera.position.x = 1400 * Math.sin( theta * Math.PI / 360 );
		        camera.position.z = 1400 * Math.cos( theta * Math.PI / 360 );
		
		        renderer.render( scene, camera );
		
		      };
		      
		      $("body").keydown(function(event){

  				switch( event.keyCode ) {
					
					case 65: moveLeft = true; object1.position.z += cubesize; break; // a
					case 68: moveRight = true; object1.position.z -= cubesize;break; // d
					case 87: moveUp/*pitchUp*/ = true; object1.position.x -= cubesize;break; // w
					case 83: moveDown/*pitchDown*/ = true;object1.position.x += cubesize; break; // s

				}
			  });
		});
	</script>
